
#import "JsXXTeaManagerTestController.h"
#import <JsUtilitySdk/JsUtilitySdk.h>

@interface JsXXTeaManagerTestController ()<
JsMenuViewDelegate
>

{
	JsMenuView * mMenuView;
}

@end

@implementation JsXXTeaManagerTestController

- (void)viewDidLoad {
	[super viewDidLoad];
		// Do any additional setup after loading the view.
	[self setupUi];
}

- (void)setupUi {
	self.view.backgroundColor = [UIColor whiteColor];
	{
		if(!mMenuView) {
			CGRect frame = [JsGeometryManager frameHAlignCenterVAlignBottomWithContainerSize:self.view.frame.size size:CGSizeMake(JsGeometryManager.screenSize.width, 300)];
			JsMenuView * mMenuView = [[JsMenuView alloc]initWithFrame:frame];
			mMenuView.delegate = self;
			[self.view addSubview:mMenuView];
		}
	}
}

#pragma mark JsXXTeaManagerTestController
- (NSArray<JsMenuItemVm *> *)jsMenuViewSetDatasource:(JsMenuView *)view {
	return @[
		[[JsMenuItemVm alloc]initWithTitle:@"Test"],
//		[[JsMenuItemVm alloc]initWithTitle:@"info"],
//		[[JsMenuItemVm alloc]initWithTitle:@"error"],
//		[[JsMenuItemVm alloc]initWithTitle:@"success"],
//		[[JsMenuItemVm alloc]initWithTitle:@"silent"],
//		[[JsMenuItemVm alloc]initWithTitle:@"Long silent"],
//		[[JsMenuItemVm alloc]initWithTitle:@"RotateScreen"]
	];
}

- (void)jsMenuView:(JsMenuView *)view clickMenuAtIndex:(int)index vm:(JsMenuItemVm *)vm {
	switch (index) {
		case 0:{
			NSString * str = [JsXXTeaManager xxTeaEncryptStr:@"{\"userId\":74, \"username\":\"wangq\",\"timestamp\": 1631203772878}" withKey:@"fzjs2019MaterialTea"];
			NSLog(@"%@",str);
			break;
		}
		case 1:{
			[self.view displayMessage:@"This is info" contentType:JsMessageReminderContentTypeInfo];
			break;
		}
		case 2:{
			[self.view displayMessage:@"This is error" contentType:JsMessageReminderContentTypeError];
			break;
		}
		case 3:{
			[self.view displayMessage:@"This is success" contentType:JsMessageReminderContentTypeSuccess];
			break;
		}
		case 4: {
			[self.view displayMessage:@"This is silent" contentType:JsMessageReminderContentTypeSilent];
			break;
		}
		case 5: {
			JsDisplayStyle * style = [JsDisplayStyle defaulStyle];
			style.displayPosition = JsDisplayPositionBottom;
			style.offset_displayPosition = UIOffsetMake(0, -20);
			style.mf_displayTime = 3;
			[self.view displayMessage:@"This is silent,This is a long long long long silent message" image:nil style:style];
			break;
		}
		case 6: {
				//旋转方向
			break;
		}
			
		default:
			break;
	}
}





@end
